;MINIMUM DISTANCE CLASSIFIER
;return is a per-instance, classification to one unique seed or -1 if max threshold exceeded
function min_dist, input, seeds, maxdistance, distances=distances
	sz = size(input, /dimensions)
	nclasses = n_elements(seeds[0,*])
	edist = reform(euclidean_distances(input, seeds, raw_dist=rdist))
	cluster = intarr(sz[1])
	cluster[*] = -1
	for k=0L, sz[1] - 1 do begin
		mn = min(edist[k,*], minsub)
		if (mn lt maxdistance) then cluster[k] = minsub
	endfor
	if(arg_present(distances)) then distances=rdist
	return, cluster
end